#include <cppscript>
#include "parser.hpp"

var script_main(var args)
{
	if(args.size() == 0)
	{
		writeln("Usage: parser filename [args]\n");
		return 2;
	}

	try
	{
		return parse_file(args[0])(array_from(tail(args)));
	}
	catch(var ex)
	{
		writeln("Error: " + ex["text"] + " at line " + ex["data"]);
		return 1;
	}
}

